#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QDialog>
#include <QTreeWidgetItem>
#include <QTimer>
#include "qclickedlabel.h"
namespace Ui {
    class MainWindow;
}
struct qqbuddy;
struct qqgroup;
class MainWindow : public QDialog {
    Q_OBJECT
public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();
    void EmitMSG();
    void EmitSysMSG();
    void ChangeStatus(qqbuddy* b,int lastStatus);
signals:
    void NewMesgArrived();
    void NewSysInfoArrived();
    void StatusChanged();
protected:
    void changeEvent(QEvent *e);
private slots:
    void onLoginSuccess();
    void toggleSound();
    void OnStatusChanged();
    void timerDone();
    void onClickQunButton();
    void onClickBuddyButton();
    void onClickSetButton();
    void onClickReadButton();
    void showAbout();
    void OnClose();
    void onQunClick(QTreeWidgetItem *item, int column);
    void onQunDBClick(QTreeWidgetItem *item, int column);
    void onBuddyClick(QTreeWidgetItem *item, int column);
    void onBuddyDBClick(QTreeWidgetItem *item, int column);
    void onBuddyExpanded(QTreeWidgetItem *item);
    void onBuddyCollapsed(QTreeWidgetItem *item);
    void ShowSysInfo();
    void qtqPlaySound();
private:
    void initOwner();
    void removeBuddy(qqbuddy* b,int lastStatus = 0);
    void addBuddy(qqbuddy* b,int lastStatus = 0);
    void caleGroupTitle(qqgroup* g);
    void retriveGroup();
    void retriveQun();
    void retriveBuddy();
    void showSets(bool visible);
    void initMainSettingWidget(QPushButton* button,QPixmap pixMap);
    Ui::MainWindow *ui;
    QClickedLabel* btnSet;
    QClickedLabel* btnInfoTip;
    QClickedLabel* btnQun;
    QClickedLabel* btnBuddy;
    QTimer* timer;

};

#endif // MAINWINDOW_H
